package ch11_多线程与并发;

public class SleepDemo1 extends Thread{
	int i;
	public SleepDemo1(int i) {
		this.i=i;
	}
	public void run() {
		while(i>=0) {
			System.out.print(i+" ");
			try {
				Thread.sleep(1000);
			}catch(InterruptedException e) {
				System.out.println("休眠中的线程被打断！");
			}
			i--;
		}
	}
	public static void main(String[] args) {
		System.out.println("开始倒计时：");
		new SleepDemo1(5).run();
	}
}
